/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mwt.xml.xdbforms.xformlayer.impl;

import java.util.Map;
import mwt.xml.xdbforms.xformlayer.XFormDocument;
import mwt.xml.xdbforms.xformlayer.XFormDocumentBuilder;
import mwt.xml.xdbforms.xformlayer.XFormNameSpaceResolver;
import org.w3c.dom.Document;

/**
 * Definisce una costruttore di documenti XForm
 * Implementa l'interfaccia XDocumentBuilder
 * @see XFormDocumentBuilder
 * @author Gianfranco Murador, Cristian Castiglia, Matteo Ferri
 *
 */
public class XFormDocumentBuilderImpl implements XFormDocumentBuilder {

    private XFormNameSpaceResolver xfnsr;

    public XFormDocumentBuilderImpl() {

        xfnsr = new XFormNameSpaceResolver();

    }

    public void addNameSpaceBinding(Map<String, String> map) {
        xfnsr.addBindings(map);
    }

    public XFormDocument newXFormDocument() {
        return new XFormDocumentImpl(xfnsr);
    }

    /**
     * @param source
     * @return
     */

    public XFormDocument newFormDocument(Document source){

        return new XFormDocumentImpl(source, xfnsr);
    }
}
